Trò chơi Angry Birds trong UNITY Engine
31.647 lượt xem;
1 using UnityEngine;
2 using System.Collections;
3
4 public class Destroyer : MonoBehaviour {
5
6
7 void OnTriggerEnter2D(Collider2D col)
8 {
9 //destroyers are located in the borders of the screen
10 //if something collides with them, the'll destroy it
11 string tag = col.gameObject.tag;
12 if(tag == "Bird" || tag == "Pig" || tag == "Brick")
13 {
14 Destroy(col.gameObject);
15 }
16 }
17 }
2 using System.Collections;
3
4 public class Destroyer : MonoBehaviour {
5
6
7 void OnTriggerEnter2D(Collider2D col)
8 {
9 //destroyers are located in the borders of the screen
10 //if something collides with them, the'll destroy it
11 string tag = col.gameObject.tag;
12 if(tag == "Bird" || tag == "Pig" || tag == "Brick")
13 {
14 Destroy(col.gameObject);
15 }
16 }
17 }